﻿{extend name="$index_style_layout" /}

<!--SEO相关-->
{block name="head_title"}{$info.title}{/block}
{block name="head_keword"}{$info.keywords?:$info.title}  {$s_info.name} {/block}
{block name="head_description"}{:get_word(del_html($info['content']),300)}{/block}

{block name="body_AllScorllSlide"}
<!--通栏横幅图片__STATIC__/css/qb_ui.css中控制图片宽度百分百高度行内样式设置，如不设置不小于100px---->
{qb:tag name="cms_pc_show002" type="image"}
<div class="qb_ui_AllscrollBanner">
	<a href="#1"><img src="__STATIC__/images/s0.jpg"></a>
</div>
{/qb:tag}
{/block}
{block name="body_content"}
<style>
.BaseInfos{
	width:1200px;
	margin:20px auto;
	border:#DDD solid 1px;
	border-radius:5px;
	padding:10px 0;
}
.BaseInfos .title{
	line-height:30px;
	font-size:26px;
	padding-left:15px;
}
.BaseInfos .infos{
	line-height:20px;
	padding-left:15px;
	color:#888;
	font-size:14px;
	margin-top:10px;
}
.BaseInfos .infos span{
	display:inline-block;
	padding-right:15px;
}
.BaseInfos>ul>li {
	display: inline-block;
	margin: 20px 30px;
	padding: 10px;
}
.crossline {
	text-decoration-line: line-through;
	text-decoration-color: red;
}
.good-pic {
	max-width: 300px;
	max-height: 200px;
}
.text-large {
	font-size: 120%;
}
.currency-rmb:before {
	content: '￥';
}
</style>
<script type="text/javascript">
function add_fav(id){
	var url="{:purl('fav/api/add')}?type={:config('system_dirname')}&id="+id;
	$.get(url,function(res){
		if(res.code==0){
			layer.msg('收藏成功');
		}else{
			layer.alert(res.msg);
		}
	})
}
</script>
<div class="BaseInfos">
	<div class="title">{$info.title}</div>
	<div class="infos">
		<span><i class="glyphicon glyphicon-time"></i> {:date("Y-m-d H:i:s",$info.create_time)}</span>
		<span><i class="si si-eye"></i> {$info.view}</span> 
		<span onclick="add_fav({$id})"> <li class="fa fa-fw fa-heart"></li>收藏</span> 
		<span class="manage_topic"> <li class="fa fa-cogs"></li> 管理</span> 
		{include file="index@common/manage_btn" /}
	</div>
</div>

<div class="BaseInfos" id="goods-list-container"></div>
<script>
	$(function(){

		let $container = $("#goods-list-container");

		$.get("/cms/api/searchGoods", {
			keyword: "短裙",
			page: 1,
			pageSize: 20
		}, (data) => {
			console.log(data);
			if (data.code !== 0) {
				alert(data.message);
				return;
			}
			let $ul = $("<ul></ul>");

			data.data.forEach((item) => {
				$ul.append(renderGood(item));
			});

			$container.append($ul);
		});

		function renderGood(good){
			return $(`<li>
<a href="${good.clickUrl}" target="_blank">
	<img class="good-pic" src="${good.picUrl}">
	<p><strong class="good-title">${good.title}</strong></p>
	<div>
		<span class="good-price crossline currency-rmb">${good.rawPrice}</span>
		<strong class="good-price text-large currency-rmb">${good.promPrice}</strong>
	</div>
</a>
</li>`);
		}
	});

</script>

{/block}